package ui;
//-*- mode:java; Encoding:utf8n -*-
//http://terai.xrea.jp/Swing/SortableTable.html

import javax.swing.*;
import javax.swing.table.*;

public class TestRenderer extends DefaultTableCellRenderer{
    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public TestRenderer() {
        super();
        setOpaque(true);
        setBorder(BorderFactory.createEmptyBorder(0,5,0,5));
    }
/*    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        int sortedColumn = table.convertColumnIndexToModel(column);
        super.getTableCellRendererComponent(table,value,isSelected,hasFocus,row,column);
        if(isSelected) {
            setForeground(table.getSelectionForeground());
            setBackground(table.getSelectionBackground());
        }else{
        	setForeground(table.getForeground());
            TableCellRenderer defaultRenderer = table.getTableHeader().getDefaultRenderer();
            if(defaultRenderer instanceof SortButtonRenderer) {
                int s = ((SortButtonRenderer)defaultRenderer).getState(sortedColumn);
                if(s!=SortButtonRenderer.NONE) {
                	setBackground(new Color(245,245,245));
                }else{
                	if ((row % 2) == 0){
                		setBackground(table.getBackground());
                	}else{
                		setBackground(new Color(245,245,245));
                	}
                }
            }else{
            	System.out.println("instanse");
            	setBackground(table.getBackground());
            }
        }
        
        return this;    
    }*/
}
